﻿namespace EggOfPanKu.DeckBuilder
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Data;

    using EggOfPanKu.Library.Objects;

    public class ListConverter : IValueConverter
    {
        #region Methods

        /// <summary>
        /// Converts a List of strings into a single string with commas separating each item.
        /// </summary>
        /// <param name="value">string List to be converted</param>
        /// <param name="targetType">not being used</param>
        /// <param name="parameter">not geing used</param>
        /// <param name="culture">not being used</param>
        /// <returns>An object that represents tehe comma separated list</returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return String.Join(", ", ((IList<string>)value).ToArray());
        }

        /// <summary>
        /// This method currently isn't being used.  If it were, it would convert a string into a string List using the commas in the string as a delimeter.  
        /// </summary>
        /// <param name="value">string to be converted</param>
        /// <param name="targetType">not being used</param>
        /// <param name="parameter">not being used</param>
        /// <param name="culture">not being used</param>
        /// <returns></returns>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion Methods
    }
}